#!usr/bin/python
# -*- coding: UTF-8 -*-
class Ball():
    def setName(self, name):
        self.name = name

    def kick(self):
        print('我叫%s, 该死的，谁踢我...' % self.name)

a = Ball()
namea = a.setName('球A')
b = Ball()
nameb = b.setName('球B')
c = Ball()
namec = c.setName('土豆')
a.kick()
b.kick()
c.kick()


class Ball():
    def __init__(self, name):
        self.name = name
    def kick(self):
        print('我叫%s, 该死的，谁踢我...' % self.name)

b = Ball('土豆西施')
b.kick()

class Person:
    name = '悠闲人'
p = Person()
print(p.name)

'''
name mangling
名字改编， 名字重整
在python中定义私有变量只需要在变量名或函数名前加上“__”两个下划线，那么这个函数就会变成私有的了
'''
class Person:
    __name = 'youxianyen'
p = Person()
#报错print(p.__name)

class Person:
    __name = 'youxianyen'
    def getName(self):
        return self.__name
p = Person()
print(p.getName())
print(p._Person__name) #可以这样子访问






